---
layout: "default"
title: "Zip2"
description: "Swift documentation for 'Zip2': A sequence of pairs built out of two underlying sequences, where."
keywords: "Zip2,struct,swift,documentation,generate,Stream1,Stream2,Generator,Element"
root: "/v1.2"
---

<div class="intro-declaration"><code class="language-swift">struct Zip2&lt;S0 : SequenceType, S1 : SequenceType&gt;</code></div>

<div class="discussion comment">
    <p>A sequence of pairs built out of two underlying sequences, where
the elements of the <code>i</code>th pair are the <code>i</code>th elements of each
underlying sequence.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">SequenceType, _SequenceType, _Sequence_Type</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>

<tr>
<th id="aliases">Associated Types</th>
<td>
<span id="aliasesmark"></span>
<div class="declaration">
<code class="language-swift">Stream1 = S0.Generator</code>
</div>
<div class="declaration">
<code class="language-swift">Stream2 = S1.Generator</code>
</div>
<div class="declaration">
<code class="language-swift">Generator = ZipGenerator2&lt;S0.Generator, S1.Generator&gt;</code>
<div class="comment">
    <p>A type whose instances can produce the elements of this
sequence, in order.</p>
</div>
</div>
<div class="declaration">
<code class="language-swift">Element = Generator.Element</code>
<div class="comment">
    <p><em>Type alias inferred.</em></p>
</div>
</div>
</td>
</tr>


<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init__">
<a class="toggle-link" data-toggle="collapse" href="#comment-init__">init(<wbr>_:<wbr>_:)</a><div class="comment collapse" id="comment-init__"><div class="p">
    <p>Construct an instance that makes pairs of elements from <code>s0</code> and
<code>s1</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init(_ s0: S0, _ s1: S1)</code>

    </div></div>
</div>





<h3>Instance Methods</h3>
<div class="declaration" id="func-generate">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-generate">func generate()</a>
        
<div class="comment collapse" id="comment-func-generate"><div class="p">
    <p>Return a <em>generator</em> over the elements of this <em>sequence</em>.</p>

<p>Complexity: O(1)</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func generate() -&gt; Generator</code>
    
    
</div></div>
</div>


